/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 */

import { Module } from '@ohos/hvigor';

import { AssembleHap } from '../../tasks/hook/assemble/assemble-hap.js';
import { BuildPreviewerRes } from '../../tasks/hook/previewer/build-previewer-res.js';
import { PreviewBuild } from '../../tasks/hook/previewer/preview-build.js';
import { UnitTestBuild } from '../../tasks/unitTest/unit-test-build.js';
import { AbstractHapModulePlugin } from '../common/abstract-hap-module-plugin.js';

/**
 * 对外暴露hap级别的接口和任务的plugin
 *
 * @since 2021/12/16
 */
export class LegacyHapPlugin extends AbstractHapModulePlugin {
  constructor(module: Module) {
    super(module);
  }

  initHapTasks(): void {
    this.assembleHap = new AssembleHap(this._moduleService!, true);
    this.buildPreviewerRes = new BuildPreviewerRes(this._moduleService!, true);
    this.previewBuild = new PreviewBuild(this._moduleService!, true);
    this.unitTestBuild = new UnitTestBuild(this._moduleService!, true);
    this._module.registry(this.assembleHap);
    this._module.registry(this.buildPreviewerRes);
    this._module.registry(this.previewBuild);
    this._module.registry(this.unitTestBuild);
  }
}
